/**
 * 楼盘详情
 * Created by douxc on 2015/4/22.
 */
define(function (require, exports, module) {
  'use strict';
  module.exports = function (app) {
    app.register.controller('BuildingDetailCtrl', ['$scope', '$routeParams', 'MHService',
      function ($scope, $routeParams, MHService) {
        MHService.getReq({
          url: MHService.URL.building_detail + '?id=' + $routeParams['buildingId']
        }, function (data) {
          $scope.building = data['obj'];
          //根据城市id获取城市详情
          MHService.getReq({url: MHService.URL.city_search + data['obj']['city_id']}, function (city) {
            $scope.building['city'] = city['datas']['name'];
            //location.reload();
          });
        });
      }
    ])
    ;
    app.register.directive('detailItem', function () {
      return {
        restrict: 'E',
        replace: true,
        scope: {
          title: '@',
          content: '='
        },
        template: '<div id="buildingDetail" class="am-cf am-padding-left-sm am-padding-top-xs">' +
        '<span class="am-fl mh-text-lightcolor">{{::title}}</span>' +
        '<span class="am-fl am-padding-left-xs">{{::content}}</span>' +
        '<div>'
      }
    });
  };
})
;
